package com.sangfor.ssl.service.timeqry;

import java.io.UnsupportedEncodingException;

/* loaded from: classes2.dex */
public class ServerMessage {
    private byte[] msg;

    public ServerMessage() {
        this.msg = null;
        this.msg = new byte[604];
    }

    public boolean checkHead() {
        byte[] bArr = this.msg;
        return bArr[0] == 65 && bArr[1] == 67 && bArr[2] == 75 && bArr[3] == 81;
    }

    public int getType() {
        return FormatTransfer.hBytesToInt(this.msg, 4, 4);
    }

    public int getSendStamp() {
        return FormatTransfer.hBytesToInt(this.msg, 8, 4);
    }

    public int getAckTimeout() {
        return FormatTransfer.hBytesToInt(this.msg, 12, 4);
    }

    public String getSession() {
        return new String(this.msg, 16, 16);
    }

    public int getRtUpFlux() {
        return FormatTransfer.hBytesToInt(this.msg, 32, 4);
    }

    public int getRtDownFlux() {
        return FormatTransfer.hBytesToInt(this.msg, 36, 4);
    }

    public long getTotalUpFlux() {
        return FormatTransfer.hBytesToLong(this.msg, 40, 8);
    }

    public long getTotalDownFlux() {
        return FormatTransfer.hBytesToLong(this.msg, 48, 8);
    }

    public int getBroadcaseMsgLength() {
        int hBytesToInt = FormatTransfer.hBytesToInt(this.msg, 56, 4);
        if (hBytesToInt > 604) {
            return 604;
        }
        return hBytesToInt;
    }

    public String getBroadcastMsg() {
        try {
            return new String(this.msg, 60, getBroadcaseMsgLength(), "utf-8");
        } catch (UnsupportedEncodingException unused) {
            return null;
        }
    }

    public byte[] toArray() {
        return this.msg;
    }
}
